.. _[]-operator-not-supported-for-strings:
[] operator not supported for strings
-------------------------------------
.. meta::
:description:
[] operator not supported for strings: Strings and array share the bracket operator for accessing individual elements, but the append operator ``[]`` is not supported for strings.
:og:image: https://php-errors.readthedocs.io/en/latest/_static/logo.png
:og:type: article
:og:title: [] operator not supported for strings
:og:description: Strings and array share the bracket operator for accessing individual elements, but the append operator ``[]`` is not supported for strings
:og:url: https://php-errors.readthedocs.io/en/latest/messages/%5B%5D-operator-not-supported-for-strings.html
:og:locale: en
:twitter:card: summary_large_image
:twitter:site: @exakat
:twitter:title: [] operator not supported for strings
:twitter:description: [] operator not supported for strings: Strings and array share the bracket operator for accessing individual elements, but the append operator ``[]`` is not supported for strings
:twitter:creator: @exakat
:twitter:image:src: https://php-errors.readthedocs.io/en/latest/_static/logo.png
.. raw:: html
Description
___________
Strings and array share the bracket operator for accessing individual elements, but the append operator ``[]`` is not supported for strings.
Example
_______
.. code-block:: php
Solutions
_________
+ Use the ``.`` operator to add a string at the end of another.
Changed Behavior
________________
This error may appear following an evolution in behavior, in previous versions. See ` `_.